@inject DialogService DialogService

<RadzenTemplateForm TItem="Appointment" Data="@model" Submit=@OnSubmit>
<div class="row" style="margin-bottom: 16px">
    <div class="col-md-3">
        <RadzenLabel Text="Text" />
    </div>
    <div class="col">
        <RadzenTextBox @bind-Value="@model.Text" Name="Text" />
        <RadzenRequiredValidator Text="Title is required" Component="Text" />
    </div>
</div>
<div class="row" style="margin-bottom: 16px">
    <div class="col-md-3">
        <RadzenLabel Text="Start" />
    </div>
    <div class="col">
        <RadzenDatePicker @bind-Value="@model.Start" Name="Start" ShowTime="true" />
        <RadzenRequiredValidator Text="Start is required" Component="Start" />
    </div>
</div>
<div class="row" style="margin-bottom: 16px">
    <div class="col-md-3">
        <RadzenLabel Text="End" />
    </div>
    <div class="col">
        <RadzenDatePicker Name="End" @bind-Value="@model.End" ShowTime="true" />
        <RadzenRequiredValidator Component="End" Text="End is required" />
    </div>
</div>
<div class="row">
    <div class="col-md-3"></div>
    <div class="col">
        <RadzenButton ButtonType="ButtonType.Submit" Text="Save" />
    </div>
</div>
</RadzenTemplateForm>
@code {
    [Parameter]
    public DateTime Start { get; set; }

    [Parameter]
    public DateTime End { get; set; }

    Appointment model = new Appointment();

    protected override void OnParametersSet()
    {
        model.Start = Start;
        model.End = End;
    }

    void OnSubmit(Appointment model)
    {
        DialogService.Close(model);
    }
}